<extend name="Public/base"/>
<block name="body">
<div class="am-container" >
    <div class="am-g topic-box">
        <div class="am-u-sm-8 topic-list">
            <volist name="_list" id="data">
                    <div class="item clear">
                       
	                        <div class="img">
	                        	<img class="lazy am-img-responsive" alt="{$data.title}" src="{$data.pic_url|get_image_url}">
	                        </div>
	                         <a href="{:U('/topic/'.$data['id'])}">
		                        <div class="info">
		                        	 <h3 class="">
			                        	{$data.title}
			                        </h3>
	                            	<p class="discription">{$data['subtitle']}</p>
		                        </div>
	                        </a>                
                    </div>
	                       
                        
             </volist>
        </div>
        <div class="am-u-sm-4 hot-topic">
           
                <div class="headtitle">
                    <h3>热门专题</h3>
                </div>
              
				<div>
					<volist name="hot_topic" id="data">					
						<div class="item">
							<a href="{:U('/topic/'.$data['id'])}">
								<div>
									<img class="lazy am-img-responsive" alt="{$data.title}" src="{$data.pic_url}">
								</div>
								<span>{$data.title}</span>
							</a>
						</div>
					</volist>
					
				
				</div>
            
        </div>
    </div>
    <notempty name="_page">
    	<div class="am-g">
	    	<ul class="am-pagination">{$_page}
	  	 	</ul>
	       	<button id="next" class="am-btn am-btn-block" p="2" total-page="{$total_page}">
				点击加载更多
			</button>
	    </div>
  	  </notempty>
</div>

</block>
<block name="script">
<script>
	$(function(){
		$('.topic-list .item').hover(
			function(){
				$(this).find('.info').show();
			},function(){
				$(this).find('.info').hide();
			}
		);
		
		highlight_subnav("{:U('Topic/index')}"); 
		$('#next').click(function(){
		  	LoadPage();  
		 }); 
	});
	function LoadPage(){
		
		var currentPage = $('#next').attr('p') ? $('#next').attr('p') : 1;
		$.get("{:U('Topic/index')}",{'p':currentPage},function(result){
			if(result.errno==0){
				$('.topic-list').append(result.content);
				$('#next').attr('p',result.p);
				if(result.p>$('#next').attr('total-page')){
					$('#next').html('木有了，亲');
					$('#next').attr('disabled',true);
					$('#next').addClass('disabled');
				}
			}
			
		},'json');	
	}
</script>
</block>

